var express = require('express');
var router = express.Router();
var async = require('async');
var crypto = require('crypto');

/**
 * 跳转到首页
 * */
router.get('/', function(req, res, next) {
    res.render('index/index', { title: '首页' });
});

/**
 * 跳转到首页
 * */
router.get('/login', function(req, res, next) {
    res.render('index/login', { title: '登录页面' });
});

/**
 * 跳转到首页
 * */
router.post('/login', function(req, res, next) {
    console.log(req.body.userName);
    console.log(req.body.password);
    var user={username:req.body.userName,password:req.body.password};
    res.locals.user = user;
    console.log(JSON.stringify(res.locals.user));
    res.render('index/index', { title: '登录成功首页' });
});


/**
 * 跳转到订单页面
 * */
router.get('/orderList', function(req, res, next) {
    res.render('order/orderList', { title: '订单页面' });
});

/**
 * 跳转到订单详情页面
 * */
router.get('/orderDetail', function(req, res, next) {
    var orderId=req.query.id;
    res.render('order/orderDetail', { title: '订单详情页面',orderId:orderId });
});
module.exports = router;
